home *** CD-ROM | disk | FTP | other *** search
Wrap
-------------------------------------------------------------------------------- -- Weapon Baseball Bat -- Original Carnage Contest Weapon -- Script by DC, August 2009, www.UnrealSoftware.de -------------------------------------------------------------------------------- -- Setup Tables if cc==nil then cc={} end cc.baseballbat={} -- Load & Prepare Ressources cc.baseballbat.gfx_wpn=loadgfx("weapons/baseballbat.bmp") -- Weapon Image setmidhandle(cc.baseballbat.gfx_wpn) cc.baseballbat.sfx_attack=loadsfx("throw.ogg") -- Attack Sound -------------------------------------------------------------------------------- -- Weapon: baseballbat -------------------------------------------------------------------------------- cc.baseballbat.id=addweapon("cc.baseballbat","Baseball Bat",cc.baseballbat.gfx_wpn,1) -- Add Weapon (1 use) function cc.baseballbat.draw() -- Draw -- Decrease Timer (used for animation) if weapon_timer>0.0 then weapon_timer=weapon_timer-0.5 end -- Draw if getplayeraction(0)==0 then setblend(blend_alpha) setalpha(1) setcolor(255,255,255) setscale(-getplayerdirection(0),1) setrotation(getplayerrotation(0)-(90-(weapon_timer*3))*(getplayerdirection(0))) drawimage(cc.baseballbat.gfx_wpn,getplayerx(0)+getplayerdirection(0)*7,getplayery(0)+3) end -- HUD Crosshair if weapon_shots==0 then hudcrosshair(7,3) end end function cc.baseballbat.attack(attack) -- Attack if (weapon_shots<=0) then if (attack==1) then -- No more weapon switching! useweapon(0) playsound(cc.baseballbat.sfx_attack) weapon_shots=weapon_shots+1 -- Set timer for animation weapon_timer=30 -- Collision col=0 for dist=5,20,5 do for i=-2,2,1 do if col==0 then if collision(col5x5,getplayerx(0)+getplayerdirection(0)*7+math.sin(math.rad(getplayerrotation(0)+(i*10)))*dist,getplayery(0)+3-math.cos(math.rad(getplayerrotation(0)+(i*10)))*dist,0,1,0)==1 then if playercollision()~=0 and playercollision()~=playercurrent() then playerpush(playercollision(),math.sin(math.rad(getplayerrotation(0)))*13,-math.cos(math.rad(getplayerrotation(0)))*13) playerdamage(playercollision(),30) playsound(sfx_splatter1) particle(p_ring,getplayerx(playercollision()),getplayery(playercollision())) particlecolor(255,0,0) blood(getplayerx(playercollision()),getplayery(playercollision())) col=1 break end end end end end -- End Turn endturn() end end end